home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / tde31.zip / TDECFG.H < prev    next >
C/C++ Source or Header  |  1993-08-29  |  18KB  |  532 lines

  1. /*
  2.  * the config utility now finds the offsets for the editor structures.
  3.  */
  4.  
  5. /*
  6.  * defines for the inline assembler.
  7.  */
  8. #if defined( __MSC__ )
  9.    #define  ASSEMBLE   _asm
  10. #else
  11.    #define  ASSEMBLE   asm
  12. #endif
  13.  
  14.  
  15. #define TRUE            1
  16. #define FALSE           0
  17.  
  18. #define OK              0
  19. #define ERROR           (-1)
  20.  
  21.  
  22. #define MAX_KEYS        256
  23. #define AVAIL_KEYS      233
  24.  
  25.  
  26. #define MAX_TWO_KEYS    128   /* number of two key-combos allowed by TDE  */
  27. #define STROKE_LIMIT    1024
  28.  
  29.  
  30. #define NUM_FUNC        139
  31.  
  32. #define NUM_COLORS      14
  33.  
  34. #define NUM_MODES       23
  35.  
  36. /*
  37.  * mode indexes
  38.  */
  39. #define Ins              0
  40. #define Ind              1
  41. #define PTAB             2
  42. #define LTAB             3
  43. #define Smart            4
  44. #define Write_Z          5
  45. #define Crlf             6
  46. #define Trim             7
  47. #define Eol              8
  48. #define WW               9
  49. #define Left            10
  50. #define Para            11
  51. #define Right           12
  52. #define Size            13
  53. #define Backup          14
  54. #define Ruler           15
  55. #define Date            16
  56. #define Time            17
  57. #define Initcase        18
  58. #define InflateTabs     19
  59. #define Match           20
  60. #define Ignore          21
  61. #define JustRM          22
  62.  
  63.  
  64.  
  65. #define EXIST           0
  66.  
  67. #define VIDEO_INT       0x10
  68.  
  69. #define VGA             3
  70. #define EGA             2
  71. #define CGA             1
  72. #define MDA             0
  73.  
  74. #define NORMAL          7
  75. #define COLOR_ATTR      31
  76. #define MONO_ATTR       112
  77.  
  78.  
  79. #define ESC             27
  80. #define LEFT            (75 | 0x100)
  81. #define RIGHT           (77 | 0x100)
  82. #define UP              (72 | 0x100)
  83. #define DOWN            (80 | 0x100)
  84. #define RTURN           13
  85. #define PGUP            (73 | 0x100)
  86. #define PGDN            (81 | 0x100)
  87. #define F1              (59 | 0x100)
  88. #define F2              (60 | 0x100)
  89. #define F3              (61 | 0x100)
  90. #define F5              (63 | 0x100)
  91. #define F6              (64 | 0x100)
  92. #define F7              (65 | 0x100)
  93. #define F8              (66 | 0x100)
  94. #define F10             (68 | 0x100)
  95.  
  96.  
  97. #define U_LEFT          218
  98. #define U_RIGHT         191
  99. #define VER_LINE        179
  100. #define HOR_LINE        196
  101. #define L_LEFT          192
  102. #define L_RIGHT         217
  103.  
  104. #define SAVE            0
  105. #define RESTORE         1
  106.  
  107.  
  108. /*
  109.  * Save the underlying text of the screen in a structure.  We need to know
  110.  * the column and row to begin saving the text.  Since we are doing an
  111.  * optimal save and restore, we don't know how much memory to allocate to
  112.  * the save buffer.  If we use a pointer, then we can dynamically allocate as
  113.  * much or as little memory as we need.  Finally, we need a window pointer
  114.  * to point to the next item on the stack.
  115.  */
  116. typedef struct win {
  117.    int x;
  118.    int y;
  119.    int *buf;
  120.    struct win *n;
  121. } WINDOW;
  122.  
  123.  
  124. /*
  125.  * Structure to store the row and column of a string.
  126.  */
  127. struct screen {
  128.    unsigned int   row;
  129.    unsigned int   col;
  130.    unsigned char *text;
  131. };
  132.  
  133.  
  134. /*
  135.  * video adapter stuff.
  136.  */
  137. struct vcfg {
  138.    int color;
  139.    int rescan;
  140.    int mode;
  141.    int overscan;
  142.    int adapter;
  143.    int attr;
  144.    int far *videomem;
  145. };
  146.  
  147.  
  148. typedef struct {
  149.    char sig[8];                 /* signature, so we can find struct in .exe */
  150.    int  clr[2][NUM_COLORS];     /* one array for mono and another for color */
  151. } COLORS;
  152.  
  153.  
  154. /*
  155.  * When we display a pop-up or pull-down window, we need to know a few things
  156.  * about the window and the text to display in the window.
  157.  */
  158. typedef struct {
  159.    int dply_col;        /* offset into window to begin displaying help list */
  160.    int dply_row;        /* dito */
  161.    int line_length;     /* the length of the help line in the window */
  162.    int avail_lines;     /* number of lines in the window available for list */
  163.    int v_row;           /* virtual row of cursor in window */
  164.    int select;          /* item currently selected in help list */
  165.    int num_entries;     /* total number of items in help list */
  166.    int ulft_col;        /* absolute upper left column of window */
  167.    int ulft_row;        /* absolute upper left row of window */
  168.    int total_col;       /* total number of columns in window */
  169.    int total_row;       /* total number of rows in window */
  170. } HELP_WINDOW;
  171.  
  172.  
  173. /*
  174.  * structure for list of available keys.   See default.h for more info.
  175.  */
  176. typedef struct {
  177.    char *key;           /* key name */
  178.    int  key_index;      /* offset into key structure in tde.exe file */
  179.    unsigned char func_index;     /* function of key */
  180. } KEY_DEFS;
  181.  
  182.  
  183. /*
  184.  * structure for list of available keys.   See default.h for more info.
  185.  */
  186. typedef struct {
  187.    char *key;           /* key name */
  188.    int  key_index;      /* offset into key structure in tde.exe file */
  189. } CONFIG_DEFS;
  190.  
  191.  
  192. /*
  193.  * From the source code of tde.
  194.  */
  195. typedef struct {
  196.   int key;      /* key assinged to this node, which may be text or function */
  197.   int next;     /* pointer to next node in macro def */
  198. } STROKES;
  199.  
  200. /*
  201.  * structure for the macro buffer.
  202.  */
  203. typedef struct {
  204.    char sig[8];                         /* signature, easy to find in .exe */
  205.    int  first_stroke[MAX_KEYS];         /* pointer to first key in macro */
  206.    STROKES strokes[STROKE_LIMIT];       /* buffer to hold key strokes */
  207. } MACRO;
  208.  
  209.  
  210.  
  211. /*
  212.  * "mode_infos" contain the editor mode variables.  The configuration
  213.  *  utility modifies this structure to custimize the start-up tde
  214.  *  configuration
  215.  */
  216. typedef struct {
  217.    char sig[8];                 /* signature, so we can find struct in .exe */
  218.    int  color_scheme;           /* color to start out with */
  219.    int  sync;                   /* sync the cursor movement command? */
  220.    int  sync_sem;               /* sync the cursor movement command? */
  221.    int  record;                 /* are we recording keystrokes? */
  222.    int  insert;                 /* in insert mode? */
  223.    int  indent;                 /* in auto-indent mode? */
  224.    int  ptab_size;              /* physical tab stops */
  225.    int  ltab_size;              /* logical tab stops */
  226.    int  smart_tab;              /* smart tab mode on or off? */
  227.    int  inflate_tabs;           /* inflate tabs?  T or F */
  228.    int  search_case;            /* consider case? IGNORE or MATCH */
  229.    int  enh_kbd;                /* type of keyboard */
  230.    int  cursor_size;            /* insert cursor big or small? */
  231.    char *eof;                   /* message to display at end of file */
  232.    int  control_z;              /* write ^Z - t or f */
  233.    int  crlf;                   /* <cr><lf> toggle CRLF or LF */
  234.    int  trailing;               /* remove trailing space? T or F */
  235.    int  show_eol;               /* show lf at eol? T or F */
  236.    int  word_wrap;              /* in word wrap mode? */
  237.    int  left_margin;            /* left margin */
  238.    int  parg_margin;            /* column for 1st word in paragraph */
  239.    int  right_margin;           /* right margin */
  240.    int  right_justify;          /* boolean, justify right margin?  T or F */
  241.    int  format_sem;             /* format semaphore */
  242.    int  undo_max;               /* max number of lines in undo stack */
  243.    int  do_backups;             /* create backup or ".bak" files? T or F */
  244.    int  ruler;                  /* show ruler at top of window? T or F */
  245.    int  date_style;             /* date style for date and time stamp */
  246.    int  time_style;             /* time style for date and time stamp */
  247. } MODE_INFO;
  248.  
  249.  
  250. typedef struct {
  251.    unsigned char ignore[256];
  252.    unsigned char match[256];
  253. } SORT_ORDER;
  254.  
  255.  
  256. /*
  257.  * structure for two key combos
  258.  */
  259. typedef struct {
  260.    int parent_key;
  261.    int child_key;
  262.    int func;
  263. } TWO_KEY_TYPE;
  264.  
  265.  
  266. typedef struct {
  267.    char sig[8];
  268.    TWO_KEY_TYPE key[MAX_TWO_KEYS];
  269. } TWO_KEY;
  270.  
  271.  
  272. typedef struct {
  273.    char sig[8];
  274.    unsigned char key[MAX_KEYS];
  275. } KEY_FUNC;
  276.  
  277.  
  278. /*************  prototypes for functions in  tdecfg.c  *******************/
  279. void main( int, char *[] );
  280. void build_next_table( char *, char * );
  281. int  find_offsets( char * );
  282. void xygoto( int, int );
  283. void video_config( void );
  284. int  getkey( void );
  285. void s_output( char far *, int, int, int );
  286. void cls( void );
  287. void hlight_line( int, int, int, int );
  288. void c_off( void );
  289. void c_on( void );
  290. void scroll_window( int, int, int, int, int, int );
  291. void cls( void );
  292. void show_box( int, int, struct screen *, int );
  293. void make_window( int, int, int, int, int );
  294. void buf_box( int, int, int, int, int );
  295. void clear_window( int, int, int, int );
  296. void window_control( WINDOW **, int, int, int, int, int );
  297. void save_window( int *, int, int, int, int );
  298. void restore_window( int *, int, int, int, int );
  299. /*************************************************************************/
  300.  
  301.  
  302. /*************  prototypes for functions in  cfgcolor.c  *****************/
  303. void tdecolor( void );
  304. void initialize_color( void );
  305. void restore_overscan( int );
  306. void show_init_sample( void );
  307. void color_number( char *, int );
  308. void current_color_number( char *, int );
  309. void show_help_color( void );
  310. void show_fileheader_color( void );
  311. void show_text_color( void );
  312. void show_curl_color( void );
  313. void show_dirty_color( void );
  314. void show_warning_color( void );
  315. void show_mode_color( void );
  316. void show_wrapped_color( void );
  317. void show_overscan_color( void );
  318. void show_eof_color( void );
  319. void show_ruler_color( void );
  320. void show_rulerptr_color( void );
  321. void show_block_color( void );
  322. void show_hilitedfile_color( void );
  323. void change_colors( void );
  324. /*************************************************************************/
  325.  
  326.  
  327. /*************  prototypes for functions in  cfgkeys.c  *****************/
  328. void tdekeys( void );
  329. void initialize_keys( void );
  330. void show_key_def_list( HELP_WINDOW *, KEY_DEFS * );
  331. void show_func_list( HELP_WINDOW *, char *[] );
  332. void position_cursor( HELP_WINDOW *, int, int *, int *, int * );
  333. void master_help( HELP_WINDOW *, KEY_DEFS *, struct screen *, char *, int * );
  334. void new_assignment_help( HELP_WINDOW *, char *[], struct screen *, int * );
  335. void save_and_draw( HELP_WINDOW *, struct screen *, WINDOW ** );
  336. /*************************************************************************/
  337.  
  338.  
  339. /*************  prototypes for function in  cfghelp.c  *******************/
  340. void tdehelp( void );
  341. /*************************************************************************/
  342.  
  343.  
  344. /*************  prototypes for function in  cfgmacro.c  *******************/
  345. void tdemacro( void );
  346. /*************************************************************************/
  347.  
  348.  
  349. /*************  prototypes for functions in cfgmodes.c  *****************/
  350. void tdemodes( void );
  351. void initialize_modes( void );
  352. void show_init_mode( void );
  353. void show_insert_mode( void );
  354. void show_indent_mode( void );
  355. void show_smart_mode( void );
  356. void show_ptabsize( void );
  357. void show_ltabsize( void );
  358. void show_controlz( void );
  359. void show_eol_out( void );
  360. void show_trail( void );
  361. void show_eol_display( void );
  362. void show_ww( void );
  363. void show_left( void );
  364. void show_para( void );
  365. void show_right( void );
  366. void show_cursor_size( void );
  367. void show_backup_mode( void );
  368. void show_ruler_mode( void );
  369. void show_date_style( void );
  370. void show_time_style( void );
  371. void show_initcase( void );
  372. void change_modes( void );
  373. /*************************************************************************/
  374.  
  375.  
  376. /*************  prototypes for functions in cfgfile.c    *****************/
  377. void tdecfgfile( void );
  378. void parse_line( char * );
  379. char *parse_token( char *, char * );
  380. int  search( char *, CONFIG_DEFS [], int );
  381. void parse_macro( int, char * );
  382. int  parse_literal( int, char *, char *, char ** );
  383. void initialize_macro( int );
  384. void clear_previous_macro( int );
  385. void check_macro( int );
  386. int  record_keys( int, int );
  387. void new_sort_order( unsigned char *, unsigned char * );
  388. int  get_stroke_count( void );
  389. int  getfunc( int );
  390. void clear_previous_twokey( int );
  391. int  insert_twokey( int, int, int );
  392. /*************************************************************************/
  393.  
  394.  
  395. #define   Help                        1
  396. #define   Rturn                       2
  397. #define   NextLine                    3
  398. #define   BegNextLine                 4
  399. #define   LineDown                    5
  400. #define   LineUp                      6
  401. #define   CharRight                   7
  402. #define   CharLeft                    8
  403. #define   PanRight                    9
  404. #define   PanLeft                    10
  405. #define   WordRight                  11
  406. #define   WordLeft                   12
  407. #define   ScreenDown                 13
  408. #define   ScreenUp                   14
  409. #define   EndOfFile                  15
  410. #define   TopOfFile                  16
  411. #define   BotOfScreen                17
  412. #define   TopOfScreen                18
  413. #define   EndOfLine                  19
  414. #define   BegOfLine                  20
  415. #define   JumpToLine                 21
  416. #define   CenterWindow               22
  417. #define   CenterLine                 23
  418. #define   HorizontalScreenRight      24
  419. #define   HorizontalScreenLeft       25
  420. #define   ScrollDnLine               26
  421. #define   ScrollUpLine               27
  422. #define   PanUp                      28
  423. #define   PanDn                      29
  424. #define   ToggleOverWrite            30
  425. #define   ToggleSmartTabs            31
  426. #define   ToggleIndent               32
  427. #define   ToggleWordWrap             33
  428. #define   ToggleCRLF                 34
  429. #define   ToggleTrailing             35
  430. #define   ToggleZ                    36
  431. #define   ToggleEol                  37
  432. #define   ToggleSync                 38
  433. #define   ToggleRuler                39
  434. #define   ToggleTabInflate           40
  435. #define   SetTabs                    41
  436. #define   SetLeftMargin              42
  437. #define   SetRightMargin             43
  438. #define   SetParagraphMargin         44
  439. #define   FormatParagraph            45
  440. #define   FormatText                 46
  441. #define   LeftJustify                47
  442. #define   RightJustify               48
  443. #define   CenterJustify              49
  444. #define   Tab                        50
  445. #define   BackTab                    51
  446. #define   ParenBalance               52
  447. #define   BackSpace                  53
  448. #define   DeleteChar                 54
  449. #define   StreamDeleteChar           55
  450. #define   DeleteLine                 56
  451. #define   DelEndOfLine               57
  452. #define   WordDelete                 58
  453. #define   AddLine                    59
  454. #define   SplitLine                  60
  455. #define   JoinLine                   61
  456. #define   DuplicateLine              62
  457. #define   AbortCommand               63
  458. #define   UndoLine                   64
  459. #define   UndoDelete                 65
  460. #define   ToggleSearchCase           66
  461. #define   FindForward                67
  462. #define   FindBackward               68
  463. #define   RepeatFindForward1         69
  464. #define   RepeatFindForward2         70
  465. #define   RepeatFindBackward1        71
  466. #define   RepeatFindBackward2        72
  467. #define   ReplaceString              73
  468. #define   DefineDiff                 74
  469. #define   RepeatDiff                 75
  470. #define   MarkBox                    76
  471. #define   MarkLine                   77
  472. #define   MarkStream                 78
  473. #define   UnMarkBlock                79
  474. #define   FillBlock                  80
  475. #define   NumberBlock                81
  476. #define   CopyBlock                  82
  477. #define   KopyBlock                  83
  478. #define   MoveBlock                  84
  479. #define   OverlayBlock               85
  480. #define   DeleteBlock                86
  481. #define   SwapBlock                  87
  482. #define   BlockToFile                88
  483. #define   PrintBlock                 89
  484. #define   BlockExpandTabs            90
  485. #define   BlockCompressTabs          91
  486. #define   BlockIndentTabs            92
  487. #define   BlockTrimTrailing          93
  488. #define   BlockUpperCase             94
  489. #define   BlockLowerCase             95
  490. #define   BlockRot13                 96
  491. #define   BlockFixUUE                97
  492. #define   BlockEmailReply            98
  493. #define   BlockStripHiBit            99
  494. #define   SortBoxBlock              100
  495. #define   DateTimeStamp             101
  496. #define   EditFile                  102
  497. #define   DirList                   103
  498. #define   File                      104
  499. #define   Save                      105
  500. #define   SaveAs                    106
  501. #define   SetFileAttributes         107
  502. #define   EditNextFile              108
  503. #define   DefineGrep                109
  504. #define   RepeatGrep                110
  505. #define   RedrawScreen              111
  506. #define   SizeWindow                112
  507. #define   SplitHorizontal           113
  508. #define   SplitVertical             114
  509. #define   NextWindow                115
  510. #define   PreviousWindow            116
  511. #define   ZoomWindow                117
  512. #define   NextHiddenWindow          118
  513. #define   SetMark1                  119
  514. #define   SetMark2                  120
  515. #define   SetMark3                  121
  516. #define   GotoMark1                 122
  517. #define   GotoMark2                 123
  518. #define   GotoMark3                 124
  519. #define   RecordMacro               125
  520. #define   PlayBack                  126
  521. #define   SaveMacro                 127
  522. #define   LoadMacro                 128
  523. #define   ClearAllMacros            129
  524. #define   Pause                     130
  525. #define   Quit                      131
  526. #define   NextDirtyLine             132
  527. #define   PrevDirtyLine             133
  528. #define   FindRegX                  134
  529. #define   RepeatFindRegX            135
  530. #define   RepeatFindRegXBackward    136
  531. #define   DefineRegXGrep            137
  532.